﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using S.Y.Passport.Domain.溯源;
using S.Y.Passport.ErroeCode;
using S.Y.Passport.Write.API.Applications.Commands;
using S.Y.Passport.Write.API.Dtos;

namespace S.Y.Passport.Write.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManagementController : ControllerBase
    {
        private readonly IMediator mediator;

        public ManagementController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpGet]
        public Task<SyResult<SyPaing<GoodsInfo>>> GetGoodsQuery([FromQuery]GetGoodsQueryCommand command)
        {
            try
            {
                return mediator.Send(command);
            }
            catch (Exception)
            {

                throw;
            }
        }
        [HttpGet]
        public Task<SyResult<GoodsInfo>> FanGoodsQuery([FromQuery]FanGoodsQueryCommand command)
        {
            try
            {
                return mediator.Send(command);
            }
            catch (Exception)
            {

                throw;
            }
        }

    }
}
